import request from '@/router/axios';

export const getList = (page, size, params) => {
	return request({
		url: '/cards/sellerCoupon/list',
		method: 'post',
		params: {
			...params,
			page,
			size,
		}
	})
}
export const remove = (id) => {
	return request({
		url: '/cards/sellerCoupon/delete',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: {
			id,
		}
	})
}

export const add = (row) => {
	return request({
		url: '/cards/sellerCoupon/addItem',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: row
	})
}

export const update = (row) => {
	return request({
		url: '/cards/sellerCoupon/editItem',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: row
	})
}

export const detail = (row) => {
	return request({
		url: '/cards/sellerCoupon/detail',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: row
	})
}

export const getListGoods = (row) => {
	return request({
		url: '/base/sellerGoods/listGoods',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: row
	})
}

export const changeStatus = (userId, status) => {
	return request({
		url: '/cards/sellerCoupon/changeStatus',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: {
			userId,
			status
		}
	})
}
//获取下拉列表
export const listAllLevelThree = () => {
	return request({
		url: '/base/goodsClass/listAllLevelThree',
		method: 'post',
	})
}
//根据下拉id获取商品
export const getGoods = (page,size,params) => {
	return request({
		url: '/base/sellerGoods/listActivityGoods',
		method: 'post',
		params: {
			...params,
			page,
			size,
		}
	})
}
export const setAddItem = (couponId,goodsIds) => {
	return request({
		url: '/cards/sellerCouponGoods/addItem',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: {
			couponId,
			goodsIds
		}
	})
}
//根据下拉id获取商品
export const getGoodsList = (page,size,params) => {
	return request({
		url: '/cards/sellerCouponGoods/list',
		method: 'post',
		params: {
			...params,
			page,
			size,
		}
	})
}
//卖家优惠券使用详情
export const getCouponList = (page,size,params) => {
    return request({
        url: '/cards/sellerCouponInfo/list',
        method: 'post',
        params: {
            ...params,
            page,
            size,
        }
    })
}
//查询已经选中的商品
export const getListGoodsIds = (couponId) => {
	return request({
		url: '/cards/sellerCouponGoods/listGoodsIds',
		method: 'post',
		meta: {
			isSerialize: true,
		},
		data: {
			couponId,
		}
	})
}

